package com.justnow.offer;

import java.util.*;
import java.util.stream.Stream;

/**
 * @author justnow
 * Created on 2020-09-03
 * Description
 */
public class Solution45 {
    public String minNumber(int[] nums) {

        List<String> list = new ArrayList<>();

        for (int num : nums) {
            list.add(String.valueOf(num));
        }

        //定义一种一种新的排序规则，如果s1 + s2 > s2 + s1，那么就说明拼接时将s2 放到 s1的前面
        list.sort((s1, s2) -> {
            return (s1 + s2).compareTo(s2 + s1);
        });
        StringBuilder stringBuilder = new StringBuilder();
        for (String s : list) {
            stringBuilder.append(s);
        }
        return stringBuilder.toString();
    }

    public static void main(String[] args) {
        List<Integer> list= new ArrayList<>();
        list.add(10);
        list.add(7);
        list.add(19);
        list.add(20);
        list.add(14);
        list.sort((x1, x2) -> x1.compareTo(x2));
        for (Integer s : list) {
            if (s == 7)
                list.remove(1);
            //System.out.println(s);
        }
        List<Integer> list2 = new LinkedList<>();
        System.out.println(0^1);
        System.out.println(1^1);
        System.out.println(0^0);

    }
}
